<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- <span>姓名：</span>
    <input type="text" id="name"><br>
    <span>密码：</span>
    <input type="text" id="password"><br>
   <input type="button" value="提交" id="submit"><br> -->
   <!--通过form表单来创建post请求-->
   <form action="postGetParameter" method="post">
    <span>姓名：</span>
    <input type="text" name="name"><br>
    <span>密码：</span>
    <input type="password" name="pasaword"><br>
    <input type="submit" value="提交">
   </form>
   <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
</body>


<!-- <script>
    let nameIput=document.querySelector("#name");
    let passwordInput=document.querySelector("#password");
    let button=document.querySelector("#submit");
    button.onclick=function(){
        $.ajax({
           type:'post',
           url: 'postJson',
           contentType:'application/json',
           data:JSON.stringify({
            name:nameIput.value,
            password:passwordInput.value,
           }),
           success:function(body){
            console.log(body);
           }
        });
}
</script> -->
</html>